# -*- coding:utf8 -*- #
# -----------------------------------------------------------------------------------
# ProjectName:  smalleel-api-tools
# FileName:     acceptance_main.py
# Author  :     
# Datetime:     2023/3/31 11:14
# Description：基站,电表,注册出入库上线运行文件
# -----------------------------------------------------------------------------------
from common.util.randomUtil.randomUtil import get_random_char
from tool.process.smalleelLogin import Login
from tool.process.acceptance.smalleel.register.register_acceptance import RegisterEquipment
from tool.process.acceptance.merchant.merchant_acceptance import Merchant


def accept_main():
    """
    注意：运行此文件时需要在配置中（acceptConfig.py）选择deviceType = 1
    """
    Login().login_smalleel()
    Login().login_merchant()
    Login().login_platform()
    regist = RegisterEquipment()
    mer = Merchant()
    # 基站号和表号
    collectoNo = "C5" + get_random_char(10)
    collectoNum = 1
    # 电表表号
    meterNo = int("4552023" + get_random_char(4) + "4")
    meterNum = 1
    # 注册基站后入库并出库到对应项目
    regist.register_collector(collectoNo, collectoNum)
    # 注册电表后入库并出库到对应项目
    regist.register_meter(meterNo, meterNum)
    # 小程序添加基站
    mer.add_Collector(collectoNo, collectoNum)
    # 小程序添加电表
    mer.add_Db(meterNo, meterNum)


if __name__ == '__main__':
    accept_main()
